<template>
  <el-card shadow="never" class="aui-card--fill">
    <div class="mod-wms_detail_task}">
      <el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
        <el-form-item label="托盘条码">
          <el-input v-model="dataForm.contNo" placeholder="请输入托盘条码" maxlength="32" clearable></el-input>
        </el-form-item>
        <el-form-item>
          <el-button @click="getDataList()" type="primary">{{ $t("query") }}</el-button>
        </el-form-item>
        <el-form-item>
          <el-button @click="getReset()">{{ $t("reset") }}</el-button>
        </el-form-item>
      </el-form>
      <el-table v-loading="dataListLoading" :data="dataList" border @selection-change="dataListSelectionChangeHandle"
        style="width: 100%">
        <el-table-column prop="taskId" label="id" header-align="center" align="center" sortable></el-table-column>
        <el-table-column prop="taskType" label="任务类型" header-align="center" align="center">
          <template slot-scope="scope">
            <el-tag v-if="scope.row.taskType === '01'" type="info">入库</el-tag>
            <el-tag v-else-if="scope.row.taskType === '02'" type="info">出库</el-tag>
            <el-tag v-else-if="scope.row.taskType === '03'" type="info">移动</el-tag>
            <el-tag v-else>未知场景</el-tag>
          </template>
        </el-table-column>
        <el-table-column prop="taskSubType" label="业务场景" header-align="center" align="center"></el-table-column>
        <el-table-column prop="originContNo" label="托盘条码" header-align="center" align="center"></el-table-column>
        <el-table-column prop="spuNo" label="砂芯图号" header-align="center" align="center" min-width="150">
        </el-table-column>
        <el-table-column prop="planQnty" label="计划量" header-align="center" align="center"></el-table-column>
        <el-table-column prop="actlQnty" label="实际量" header-align="center" align="center"></el-table-column>
        <el-table-column prop="originPosition" label="起始位置" header-align="center" align="center" min-width="150">
        </el-table-column>
        <el-table-column prop="targetPosition" label="目标位置" header-align="center" align="center" min-width="150">
        </el-table-column>
        <el-table-column prop="currentPosition" label="当前位置" header-align="center" align="center" min-width="150">
        </el-table-column>
        <el-table-column prop="mtNo" label="单据编号" header-align="center" align="center" min-width="145">
        </el-table-column>
        <el-table-column prop="dtId" label="明细id" header-align="center" align="center"></el-table-column>
        <el-table-column prop="stockId" label="库存id" header-align="center" align="center"></el-table-column>
        <el-table-column prop="taskSt" label="任务状态" header-align="center" align="center">
          <template slot-scope="scope">
            <el-tag v-if="scope.row.taskSt === 0">初始</el-tag>
            <el-tag v-else-if="scope.row.taskSt === 1" type="warning">执行中</el-tag>
            <el-tag v-else-if="scope.row.taskSt === 2" type="success">已完成</el-tag>
            <el-tag v-else type="danger">异常</el-tag>
          </template>
        </el-table-column>
        <el-table-column prop="creatorName" label="创建用户" header-align="center" align="center" show-overflow-tooltip>
        </el-table-column>
        <el-table-column prop="createDate" label="创建日期" header-align="center" align="center" min-width="155" sortable>
        </el-table-column>
        <el-table-column prop="updaterName" label="更新用户" header-align="center" align="center" show-overflow-tooltip>
        </el-table-column>
        <el-table-column prop="updateDate" label="更新日期" header-align="center" align="center" min-width="155" sortable>
        </el-table-column>
        <el-table-column prop="comments" label="备注" header-align="center" align="center" show-overflow-tooltip>
        </el-table-column>
      </el-table>
      <el-pagination :current-page="page" :page-sizes="[10, 20, 50, 100]" :page-size="limit" :total="total"
        layout="total, sizes, prev, pager, next, jumper" @size-change="pageSizeChangeHandle"
        @current-change="pageCurrentChangeHandle">
      </el-pagination>
    </div>
  </el-card>
</template>

<script>
import mixinViewModule from "@/mixins/view-module";
export default {
  mixins: [mixinViewModule],
  data() {
    return {
      mixinViewModuleOptions: {
        getDataListURL: "/wms/task/page",
        getDataListIsPage: true,
      },
      dataForm: {
        contNo: "",
        mtNo: "0",
        dtId: "0",
      },
    };
  },
  created() {
    this.dataForm.mtNo = this.$route.params.mtNo || "0";
    this.dataForm.dtId = this.$route.params.dtId || "0";
    this.getDataList();
  },
  methods: {
    //0.重置搜索框
    getReset() {
      this.dataForm = this.$options.data().dataForm;
    },
  },
};
</script>
